class AnswerItem implements java.lang.Comparable{

	Answer answer
	int answerOrder
	String questionItemId

	static mapping = {
		table 'VOTING_ANSWER_ITEM'
	}

	static belongsTo = Answer

    static constraints = {
		answerOrder(blank:false)
		questionItemId(bank:false, maxSize: 6)
    }

	String toString() {
		"${this.questionItemId}"
	}

	int compareTo(Object ai) {
		this.answerOrder.compareTo(ai.answerOrder)
	}
}
